package com.example.chapter0603;

import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;


public class IndexFragment extends Fragment {


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View inflate = inflater.inflate(R.layout.fragment_index, container, false);
        Button btn = inflate.findViewById(R.id.btn_index_contact);
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                getParentFragmentManager().beginTransaction()
                        .replace(R.id.fragment,new MeFragment())
                        .commit();
//                getParentFragmentManager().beginTransaction()
//                        .replace(R.id.fragment,ContactFragment.newInstance("1","2"))
//                        .commit();
//                getFragmentManager().beginTransaction()
//                        .replace(R.id.fragment,new ContactFragment())
//                        .commit();
            }
        });
        return inflate;
    }
}